import java.util.*;

class Solution {
    public static int[] twoSum(int[] nums, int target) {
        Map<Integer,Integer> hash = new HashMap<>();
        for(int i = 0; i < nums.length; i++){
            int x = target - nums[i];
            if(hash.containsKey(x)){
                return new int[]{i,hash.get(x)};
            }
            hash.put(nums[i],i);
        }
        return new int[]{-1,-1};
    }

    public static void main(String[] args){
        String arrayStr = args[0];
        arrayStr = arrayStr.substring(1,arrayStr.length() - 1);
        String[] numStrs = arrayStr.split(",");
        int[] nums = new int[numStrs.length];
        for(int i = 0; i < numStrs.length; i++){
            nums[i] = Integer.parseInt(numStrs[i].trim());
        }

        String targetStr = args[1];
        int target = Integer.parseInt(targetStr.trim());
        int[] result = twoSum(nums, target);
        Arrays.sort(result); // 对索引进行排序（从小到大）
        System.out.println(Arrays.toString(result));
        ///System.out.println(Arrays.toString(twoSum(nums, target)));

//        // 打印所有参数，看是否被正确接收
//        System.out.println("参数个数：" + args.length);
//        for (int i = 0; i < args.length; i++) {
//            System.out.println("args[" + i + "] = " + args[i]);
//        }

    }
}
